package com.neucollege.system.result;

import com.neucollege.system.constant.NumberConstant;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
    int code;
    String message;
    T data;

    public static Result success() {
        return new Result(NumberConstant.SUCCESS, null, null);
    }

    public static <T> Result<T> success(T t) {
        return new Result(NumberConstant.SUCCESS, null, t);
    }

    public static Result error(String message) {
        return new Result(NumberConstant.ERROR, message, null);
    }

    public static Result notLogin(String message){
        return new Result(NumberConstant.NOT_LOGIN,message,null);
    }
}
